<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>列表渲染基础01</title>
</head>
<body>
  <div id="app">
    <ul>
      <!-- 1.循环普通数组 -->
      <!-- <li v-for="item in datas">{{ item }}</li> -->
      <!-- 带数组索引 -->
      <li v-for="(item, index) in datas">{{ index }} : {{ item }}</li>
    </ul>
    <ul>
      <li>序号 | 姓名 | 年龄</li>
      <!-- 2.循环对象数组 -->
      <!-- <li v-for="item in items">{{ item.id }} | {{ item.name }} | {{ item.age }}</li> -->
      <li v-for="(item, index) in items">{{ item.id }} | {{ item.name }} | {{ item.age }}</li>
    </ul>
    <div>
      <!-- 3.循环对象 -->
      <!-- 此时 item 表示 value -->
      <p v-for="item in user">{{ item }}</p>
      <p v-for="(value, key) in user">{{ key }} : {{ value }}</p>
      <p v-for="(value, key, index) in user">{{ index }} | {{ key }} : {{ value }}</p>
    </div>
    <div>
      <!-- 4. 对数字进行遍历 -->
      <p v-for="count in 10">这是对数字进行轮巡，当前的数字是: {{ count }}</p>
    </div>
  </div>
</body>
<script src="./src/vue.js"></script>
<script>
  const vm = new Vue({
    el: '#app',
    data: {
      datas: [1,2,3,4,5,6,7,8,9],
      items: [
        {id:1, name:'刘备', age: 33},
        {id:2, name:'关羽', age: 32},
        {id:3, name:'张飞', age: 31},
        {id:4, name:'诸葛亮', age: 30},
      ],
      user: {
        name: '王一博',
        age: 24,
        sex: '男',
        phone: '12345677654'
      }
    }
  })
</script>
</html>